{% extends "base_content.html" %}
{% load engine_tags %}

{% block headtitle %}
    Job View: {{ job.name }}
{% endblock %}

{% block content %}
<div class="job" data-value="{{ job.uid }}">

    <div id="view">
        <div class="ui divided link items ">

            <div class="item">

                {% job_img job %}
                <div class="ui text container">
                    <div class="content ">
                        <a class="subheader link" href="{% url 'job_view' job.uid %}">
                            <i class="bar chart icon"></i>{{ job.get_name }}
                        </a>
                        <div class="meta">{{ job.summary|markdown|safe }}</div>
                        <div class="extra">
                            <span class="state">{% job_minutes job view=True %}</span>&bull;
                            {% created_by date=job.lastedit_date user=job.lastedit_user %}
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="ui large vertical center aligned {% job_color job %} segment">

            <a class="ui button" href="{% url 'recipe_view' job.analysis.uid %}#code">
                <i class="code icon"></i> <span class="fitme">Recipe Code</span>
            </a>
            <a class="ui button" href="{% url "job_rerun" job.uid %}">
                <i class="redo icon"></i> <span class="fitme">Rerun Recipe</span>
            </a>

            <a class="ui button" href="{% url "job_edit" job.uid %}">
                <i class="edit icon"></i> <span class="fitme">Edit Result</span>
            </a>

            <!--
            <a class="ui copy button">
                <i class="copy icon"></i>Copy Result
            </a>
            -->

            <a class="ui button" href="{% url "job_delete" job.uid %}">
                {% if job.deleted %}
                    <i class="undo icon"></i> <span class="fitme">Restore</span>
                {% else %}
                    <i class="trash icon"></i> <span class="fitme">Delete Result</span>
                {% endif %}
            </a>

    </div>
</div>

    <div class="ui vertical large segment">
        {{ job.html|safe }}
    </div>

    <div class="ui vertical large segment" id="flist">
        <div class="ui aligned header">File List</div>
        <div>Files created by the recipe run:</div>
        {% include 'widgets/files_list.html' %}
    </div>

    <div class="ui vertical segment" id="stdout">
        <div id="log"></div>
        <div class="ui aligned header">Output Messages</div>
        <div>Messages printed to the standard output stream:</div>
        <pre>{{ stdout }}</pre>

        <div class="loader">
            {% if job.is_running %}
                <div class="ui log compact message">
                    <span class="ui active small inline loader"></span>
                </div>
            {% endif %}
        </div>
    </div>

    <div class="ui vertical segment">
        <div class="ui aligned header">Other Messages</div>
        <div>Messages printed to the standard error stream:</div>
        <pre id="stderr">{{ stderr }}</pre>

    </div>



{% endblock %}
